package yqt.com.cnki.Common;

import haha.life.normal.TokenUtils;
import jzqb.bo.AdminUserInfoBo;
import jzqb.service.AdminUserInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;


@Component
public class Tool {

    @Autowired
    AdminUserInfoService adminUserInfoService;

    public AdminUserInfoBo getCurrentUser(HttpServletRequest request) {
        String currentUserId = TokenUtils.getCurrentUserId(request);
        AdminUserInfoBo user = null;
        if (currentUserId != null) {
            user = adminUserInfoService.basicInfo(currentUserId);
        }
        return user;
    }
}
